import pandas as pd
# 注： xlrd==1.2.0

def readExcel():
    # 默认读取sheet1
    data1 = pd.read_excel("source-excel.xlsx")


    # 指定sheet名(工作表名），获取Sheet2
    data2 = pd.read_excel("source-excel.xlsx", sheet_name="Sheet2")

    # 指定sheet索引(工作表索引，索引从0开始），获取sheet2
    data3 = pd.read_excel("source-excel.xlsx", sheet_name=1)

    print(data1)
    print(data2)
    print(data3)

def saveExcel():
    data = pd.DataFrame(data = [
        ['s1 - 1 - 1',    's1 - 2 - 1'],
        ['s1 - 1 - 2',    's1 - 2 - 2'],
        ['s1 - 1 - 3',    's1 - 2 - 3'],
        ['s1 - 1 - 4',    's1 - 2 - 4'],
        ['s1 - 1 - 5',    's1 - 2 - 5']
    ], columns=["col1", "col2"])

    writer = pd.ExcelWriter('source-excel-save.xlsx')
    # index=False 不保留索引
    data.to_excel(writer, "Sheet1", index=False)
    writer.save()

if __name__ == '__main__':
    readExcel()
    # saveExcel()